// Scan and process command line arguments
// By DreamVB

#include <iostream>

using namespace std;
using std::cout;
using std::endl;

int main(int argc, char *argv[]){

	//Sample commmand line
	//app.exe -a -b FileToProcess.txt

	//Exit if no arguments
	if(argc <=1){
		return  0;
	}

	//Get part appname
	argv++;

	//Check if argc is > 1 and then scan for flag char - and process as required.
	while (argc > 1 && *(*argv)++== '-'){
		if(argv){
			//By here we can now do what ever with switchs found.
			switch(toupper(**argv)){
			case 'A':
				cout << "A Flag was found, Put your code here" << endl;
				break;
			case 'B':
				//make a beep.
				cout << (char)7;
				break;
			case 'H':
				cout << "You can put your help message here." << endl;
				exit(1);
			default:
				cout << "Unknown input argument found." << endl;
				break;
			}
		}
		//Get next
		argc--;
		argv++;
	}

	//Move back one so we can get the filename at the end of the flags
	(*argv)--;
	//Print out file name
	cout << "Filename = " << argv[0] << endl;

	system("pause");
	return 1;
}